//
//  MyViewController.m
//  coachmanage
//
//  Created by 众拳科技 on 2018/3/6.
//  Copyright © 2018年 众拳科技. All rights reserved.
//

#import "MyViewController.h"

@interface MyViewController ()<UITableViewDelegate,UITableViewDataSource>

//数据源
@property(nonatomic,strong)NSMutableArray *dataArr;

@property(nonatomic,weak)UITableView *tableView;

@end

@implementation MyViewController

-(void)viewWillAppear:(BOOL)animated
{
    
    [super viewWillAppear:YES];
    
    [self.navigationController setNavigationBarHidden:YES animated:YES];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = BackGroundColor;
    
    [self tableView];
    
    // Do any additional setup after loading the view.
}

#pragma mark -- 懒加载

-(NSMutableArray *)dataArr
{
    if (!_dataArr) {
        _dataArr = [NSMutableArray array];
    }
    return _dataArr;
}

-(UITableView *)tableView
{
    if (!_tableView) {
        
//        CGRectMake(0, CZQ_NavigationBarHeight + CZQ_StatusBarHeight, kScreenWidth, kScreenHeight - (CZQ_NavigationBarHeight + CZQ_StatusBarHeight + CZQ_TabbarHeight) )
        
        UITableView *tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, CZQ_NavigationBarHeight + CZQ_StatusBarHeight, kScreenWidth, kScreenHeight - (CZQ_NavigationBarHeight + CZQ_StatusBarHeight + CZQ_TabbarHeight) ) style:UITableViewStyleGrouped];
        
        tableView.delegate=self;
        
        tableView.dataSource=self;
        
        tableView.backgroundColor = CSClearColor;
        
        tableView.rowHeight = 50;
        
        [self.view addSubview:tableView];
        
//        [tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
//
//            make.edges.mas_equalTo(self.view);
//
//        }];
        
        //        tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        
        
        //注册
        //                [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
        //        [tableView registerNib:[UINib nibWithNibName:@"YDTrainingTableViewCell" bundle:nil]  forCellReuseIdentifier:@"cell"];
        //        [tableView registerNib:[UINib nibWithNibName:@"YDTrainingTableViewCell" bundle:nil]  forCellReuseIdentifier:@"cell"];
        _tableView = tableView;
    }
    return _tableView;
}

#pragma mark - UITableViewDataSource

//行数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 3;
}

//列数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    if (section == 2) {
        
        return 60;
        
    }
    
    return 1;
}

//cell内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell;
    if (!cell) {
        
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    
    return cell  ;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section != 0) {
        
        return  10;
        
    }
    return CGFLOAT_MIN;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return CGFLOAT_MIN;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    return [[UIView alloc]initWithFrame:CGRectZero];
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    return [[UIView alloc]initWithFrame:CGRectZero];
}



-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //当离开某行时，让某行的选中状态消失
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
